<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    response.setHeader("cache-control","public");
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<!-- 往试卷中添加试题 -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/font/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/common.css">
    <link rel="stylesheet" href="<%=path%>/static/css/examMng/examMng.css" />
    <!--bootstrap基础引用 start-->
	<script type="text/javascript" src="<%=path%>/static/jstreeview/bootstrap/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="<%=path%>/static/js/bootstrap.min.js"></script>
	<!--bootstrap基础引用 end-->
	<!--bootstrap-dialog start-->
	<link rel="stylesheet" type="text/css" href="<%=path%>/static/jstreeview/plugins/bootstrap-dialog/bootstrap-dialog.min.css">
	<script type="text/javascript" src="<%=path%>/static/jstreeview/plugins/bootstrap-dialog/bootstrap-dialog.min.js"></script>
	<!--bootstrap-dialog end-->
    <style type="text/css">
        .info-ad-photo img {
            display: block;
            /*margin: 30px auto;*/
            width: 120px;
            /* height: 160px;*/
            border: 0px;
        }
        .validate_input1 {
            position: absolute;
            right: 200px;
            top: 18px;
            z-index: 9;
            color: #ff2600;
            display: none;
        }
    </style>
    <script src="<%=path%>/static/js/respond.js"></script>
    <script src="<%=path%>/static/js/jquery-2.0.3.min.js"></script>
    <script src="<%=path%>/static/js/jquery-1.9.1.min.js"></script>
    <script src="<%=path%>/static/js/jquery.selectlist.js" ></script>
    <script src="<%=path%>/static/js/global.js" ></script>

</head>
<body>

<jsp:include page="../head.jsp" flush="true"/>

<!--body begin-->
<div class="main-container">
    <div class="container info-add body-box">
        <div class="info-add-box" style="background: #4c4ca6">
            <p>添加试题:</p>
            <a href="javascript:history.go(-1);"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;返回</a>
        </div>
        <FORM id="question">
            <div class="additem-container" style="position: relative; z-index: 1;">
                <div class="input-group input-group-lg testtype">
                    <span class="input-group-addon" id="sizing-addon1">题目类型</span>
                    <c:if test="${label eq 'edit' }">
                        <input name="questionId" type="hidden" value="${upQuestion.id }">
                    </c:if>
                    <c:choose>
                        <c:when test="${label eq 'edit' }">
                            <input name="typeId" type="hidden" value="${upQuestion.questiontype_id }">
                        </c:when>
                        <c:otherwise>
                            <input name="typeId" type="hidden" value="${typeId }">
                            <input name="conId" type="hidden" value="${conId }">
                        </c:otherwise>
                    </c:choose>

                    <!--<div class="titletype-jt" style="border-radius: 0px 4px 4px 0px;">请选择试题类型<span class="validate">试题类型为选择</span></div>-->
                    <select id="jinni" style="height:60px" disabled="disabled">
                        <c:choose>
                            <c:when test="${label eq 'edit' }">
                                <c:forEach items="${typeList }" var="ttype">
                                    <option value="${ttype.id }" <c:if test="${ttype.id == upQuestion.questiontype_id}"> selected</c:if>>${ttype.name}</option>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <c:forEach items="${quList }" var="quType">
                                    <option value="${quType.id }" <c:if test="${quType.id == typeId}"> selected</c:if>>${quType.name}</option>
                                </c:forEach>
                            </c:otherwise>
                        </c:choose>

                    </select>
                </div>
                <div class="input-group input-group-lg testtype">
                    <span class="input-group-addon" id="sizing-addon1">题目难度</span>
                    <!--<div class="titletype-jt" style="border-radius: 0px 4px 4px 0px;">请选择试题类型<span class="validate">试题类型为选择</span></div>-->
                    <select name="type" id="jinni2" style="height:60px" >
                        <c:choose>
                            <c:when test="${label eq 'edit' }">
                                <c:if test="${upQuestion.type==1 }">
                                    <option value="1" selected >简单</option>
                                    <option value="2" >中等</option>
                                    <option value="3" >困难</option>
                                </c:if>
                                <c:if test="${upQuestion.type==2 }">
                                    <option value="1" >简单</option>
                                    <option value="2" selected >中等</option>
                                    <option value="3" >困难</option>
                                </c:if>
                                <c:if test="${upQuestion.type==3 }">
                                    <option value="1" >简单</option>
                                    <option value="2" >中等</option>
                                    <option value="3" selected >困难</option>
                                </c:if>
                            </c:when>
                            <c:otherwise>
                                <option value="1" >简单</option>
                                <option value="2" >中等</option>
                                <option value="3" >困难</option>
                            </c:otherwise>
                        </c:choose>
                    </select>
                </div>
                <!--
                    时间：2016-06-08
                    描述：选择试题类型，1判断题：则展示判断题的表单；2：单项选择：显示单项选择的框；3：多项选择：选择多项选择；
                -->
                <div class="input-group input-group-lg tgtest reg-box" style="position: relative; z-index: 1;">
                    <span class="input-group-addon tgbox">题干</span>
                    <c:choose>
                        <c:when test="${label eq 'edit' }">
                            <textarea name="title" type="text" id="stem" class="form-control tginput" style="width: 83%;height: 130px;" value='${upQuestion.title }' onblur="if (value ==''){ value='请输入题干内容';document.getElementById('stem').style.color='#999';}" onfocus="if (value =='请输入题干内容'){value =''; this.style.color='#333';}">${upQuestion.title }</textarea>
                        </c:when>
                        <c:otherwise>
                            <textarea name="title" type="text" id="stem" class="form-control tginput" maxlength="200" style="width: 83%;height: 130px;" value='' placeholder="请输入题干内容" onblur="if (value ==''){ value='请输入题干内容';document.getElementById('stem').style.color='#999';}" onfocus="if (value =='请输入题干内容'){value =''; this.style.color='#333';}">请输入题干内容</textarea>
                        </c:otherwise>
                    </c:choose>
                    <span class="validate_input1 error error1"></span>
                    <div class="col-lg-2 ">
                        <c:choose>
                            <c:when test="${label eq 'edit' }">
                                <a id="imgArea"  href="javascript:file_upload_title.click()">
                                    <div class="info-ad-photo">
                                        <c:choose>
                                            <c:when test="${not empty upQuestion.picture&&!(upQuestion.picture eq null) }">
                                                <img id="pict" style="width:120px;height:120px;"  src="<%=basePath %>${upQuestion.picture}">
                                            </c:when>
                                            <c:otherwise>
                                                <img id="pict" style="width:120px;height:120px;"  src="<%=path %>/images/examMng/photos.png">
                                            </c:otherwise>
                                        </c:choose>
                                    </div>
                                    <input name="picture" id="file_upload_title" class="info-choose" type="file" style="display: none;">
                                </a>
                            </c:when>
                            <c:otherwise>
                                <a id="imgArea"  href="javascript:file_upload_title.click()">
                                    <div class="info-ad-photo"><img id="pict" style="width:120px;height:120px;"  src="<%=path %>/images/examMng/photos.png"></div>
                                    <input name="picture" id="file_upload_title" class="info-choose" type="file" style="display: none;">
                                </a>
                            </c:otherwise>
                        </c:choose>
                    </div>
                </div>
                <div id="select-options">
                    <div id="check_optx" class="answer_choose" style="display: none;">
                        <input type="radio" name="radio1" style="display: none;"></div>
                </div>
                <!--题目解析-->
                <div class="input-group input-group-lg tgtest reg-box" style="position: relative; z-index: 1;">
                    <span class="input-group-addon tmjx_box">题目解析</span>
                    <c:choose>
                        <c:when test="${label eq 'edit' }">
                            <textarea name="description" type="text"  class="form-control tginput" value='${upQuestion.analysis }' style="width: 83%;height: 130px;" onblur="if (value ==''){ value='请输入题目解析';document.getElementById('stem').style.color='#999';}">${upQuestion.analysis }</textarea>
                        </c:when>
                        <c:otherwise>
                            <textarea name="description" type="text"  class="form-control tginput" value='' maxlength="200" placeholder="请输入题目解析" style="width: 83%;height: 130px;" onblur="if (value ==''){ value='请输入题目解析';document.getElementById('stem').style.color='#999';}"></textarea>
                        </c:otherwise>
                    </c:choose>
                    <div class="col-lg-2 ">
                        <c:choose>
                            <c:when test="${label eq 'edit' }">
                                <a id="ana_img" href="javascript:file_upload2.click()">
                                    <div class="info-ad-photo">
                                        <c:choose>
                                            <c:when test="${not empty upQuestion.ana_picture&&!(upQuestion.ana_picture eq null) }">
                                                <img id="ana_pict" style="width:120px;height:120px;"  src="<%=basePath %>${upQuestion.ana_picture }">
                                            </c:when>
                                            <c:otherwise>
                                                <img id="ana_pict" style="width:120px;height:120px;"  src="<%=path %>/images/examMng/photos.png">
                                            </c:otherwise>
                                        </c:choose>

                                    </div>
                                    <div class="info-add-text text-center">
                                        <input name="ana_picture" id="file_upload2" class="info-choose" type="file" style="display: none;">
                                    </div>
                                </a>
                            </c:when>
                            <c:otherwise>
                                <a id="ana_img" href="javascript:file_upload2.click()">
                                    <div class="info-ad-photo"><img id="ana_pict" style="width:120px;height:120px;"  src="<%=path %>/images/examMng/photos.png"></div>
                                    <div class="info-add-text text-center">
                                        <input name="ana_picture" id="file_upload2" class="info-choose" type="file" style="display: none;">
                                    </div>
                                </a>
                            </c:otherwise>
                        </c:choose>

                    </div>
                </div>
                <!--题目解析-->
                <div id="pdt">
                    <p style="color:red">*&nbsp;&nbsp;判断题有且只有一个选中项</p>
                </div>
                <div id="dxxzt" style="display: none;">
                    <div class="input-group input-group-lg testtype" style="width: 100%;">
                        <a class="btn btn-default btn-block btn-lg" href="javascript:add_options(1)"><i class="glyphicon glyphicon-plus-sign"></i>添加一个选项</a>
                    </div>
                    <p style="color:red">*&nbsp;&nbsp;单项选择题有且只有一个选中项</p>
                </div>
                <div id="dxxzts" style="display: none;">
                    <div class="input-group input-group-lg testtype" style="width: 100%;">
                        <a class="btn btn-default btn-block btn-lg" href="javascript:add_options(2)"><i class="glyphicon glyphicon-plus-sign"></i>添加一个选项</a>
                    </div>
                    <p style="color:red">*&nbsp;&nbsp;多项选择题有且至少两个选中项</p>
                </div>

                <div class="border-bottom"></div>
                <div class="input-group input-group-lg testtype text-center button-grop" style="position: relative; z-index: 1; margin: 0px auto;">
                    <!-- 						<button type="button" class="btn btn-default" onClick="javascript:window.location.href='item-view.html'"><i class="glyphicon glyphicon-list"></i>试题预览</button>

                     -->
                    <c:choose>
                        <c:when test="${label eq 'edit' }">
                            <span   class="btn btn-success demo"  onclick="update();"><i class="glyphicon glyphicon-ok"></i>保 存</span>
                        </c:when>
                        <c:otherwise>
                            <span   class="btn btn-success demo"  onclick="save();"  ><i class="glyphicon glyphicon-ok"></i>保 存</span>
                        </c:otherwise>
                    </c:choose>

                </div>

            </div>
        </FORM>

    </div>
</div>
<!--body end-->

</body>
<script src="<%=path%>/static/js/examMng/addTitle-add2.js"></script>
<script src="<%=path%>/static/js/examMng/addTitle-add2_dxxzts.js"></script>
<script>

    $(function(){
        // $('#topMain').children().eq(4).addClass('active'); // 追加样式;

        //试卷管理
        if (${role eq 'master'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else if (${role eq 'trainee'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else {
            $('#topMain').children().eq(3).addClass('active'); // 追加样式;
            // $('#topMain').children().eq(3).children().attr('href', '#');
        }

    })
    var titleType = 0;
    //select下拉框模拟
    $(function(){
        $('#jinni').selectlist({
            zIndex: 10,
            height: 50,
            enable:false,
            onChange:titleTypeOnChange
        });
        titleTypeOnChange();
        $('#jinni2').selectlist({
            zIndex: 10,
            height: 50
        });

    });
    //tips提示
   /* $(function () { $("[data-tip='tooltip']").tooltip(); });*/
    var checkTitleSelectedIdx = 0;
    var isEdit = '${label}';

    function titleTypeOnChange(){
        var num = $(".select-button").val();
        if(num == "判断题"){
            if(isEdit){
                if(isEdit!='edit'){
                    add_options(0,0,"正确")
                    add_options(0,1,"错误")
                }
            }else{
                add_options(0,0,"正确")
                add_options(0,1,"错误")
            }
            $("#pdt").css("display","block");
            $("#dxxzt").css("display","none");
            $("#dxxzts").css("display","none");
            remove_addition(isEdit);
            titleType = 0;
        }
        if(num == "单选题"){
            $("#pdt").css("display","none");
            $("#dxxzt").css("display","block");
            $("#dxxzts").css("display","none");
            titleType = 1;
            //clear_check_status(1);
        }
        if(num == "多选题"){
            $("#pdt").css("display","none");
            $("#dxxzt").css("display","none");
            $("#dxxzts").css("display","block");
            titleType = 2;
            //clear_check_status(2);
        }
        $(".titletype-jt").text($("#titletype").children().eq(num).text());
        $(".titletype-jt").css("color","#555");
        $("#titletype").css("display","none");
    }

    //添加试题的提示文字
    //图片回显

    $(document).ready(function(){
        $("#imgArea").click(function(){
            var $input = $("#file_upload_title");
            $input.on("change" , function(){
                //3、回显
                var files = this.files;
                var fr = new FileReader();
                fr.onload = function(e){
                    $("#pict").attr('src',this.result);
                    //$("#pict").src = this.result;
                }
                fr.readAsDataURL(files[0]);//读取文件
            })
        })
        $("#ana_img").on("click",function(){
            var $input = $("#file_upload2");
            $input.on("change" , function(){
                //3、回显
                var files = this.files;
                var fr = new FileReader();
                fr.onload = function(e){
                    $("#ana_pict").attr('src',this.result);
                    //$("#pict").src = this.result;
                }
                fr.readAsDataURL(files[0]);//读取文件
            })
        })
    });

    var islabel = 1;
    var alertMsg = "";
    var label='${label}';
    if(label=='edit'){
        var opLength = '${edOpSize}';
    }
    var edAnswer = '${upQuestion.answer}';
    //获取后台返回的选项列表里面的值
    var temp;
    var equipmentData = [];
    var picture_url ;
    <c:forEach var="edOption" items="${edOpList}">
    picture_url = "<%=basePath %>${edOption.picture}; ";
    picture_url = picture_url .replace("\\", "\/");
    picture_url = encodeURI(picture_url);
    temp = {
        "id": "${edOption.id}",
        "title": "${edOption.title}",
        "picture":picture_url
    };
    equipmentData.push(temp);
    </c:forEach>
    $(function(){
        if(label=='edit'){
            if('${quTypeEntity.code}'=='dx'){
                for(var i=0;i<opLength;i++){
                    add_edoptions(1,"","",equipmentData[i],edAnswer);
                }
            }else{
                for(var i=0;i<opLength;i++){
                    add_edoptions(2,"","",equipmentData[i],edAnswer);
                }
            }
        }

        //判断题
        //题干获得焦点
        $("#stem").focus(function(){
            $("#stem").removeClass("errorC");
            $("#stem").removeClass("checkedN");
            $(".error1").css("display","none");

        });
        //题干失去焦点
        $("#stem").blur(function(){
            if( $("#stem").val()==""|| $("#stem").val()=="请输入题干内容")
            {
                $("#stem").removeClass("checkedN");
                $("#stem").addClass("errorC");
                $(".error1").html("题干内容不能为空");
                $(".error1").css("display","block");
                islabel = 0;
                alertMsg = "题干内容不能为空";
            }
            else
            {
                $("#stem").addClass("checkedN");
                $("#stem").removeClass("errorC");
                $(".error1").css("display","none");
            }
        });
        //题目选项获得焦点
        $(".option0").focus(function(){
            $(".option0").removeClass("errorC");
            $(".option0").removeClass("checkedN");
            $(".error2").css("display","none");
        });
        //题目选项失去焦点
        $(".option0").blur(function(){
            if( $(".option0").val()==""|| $(".option0").val()=="请输入题目选项内容")
            {
                $(".option0").removeClass("checkedN");
                $(".option0").addClass("errorC");
                $(".error2").html("选项内容不能为空");
                $(".error2").css("display","block");
                islabel = 0;
                alertMsg = "选项内容不能为空";
            }
            else
            {
                $(".option0").addClass("checkedN");
                $(".option0").removeClass("errorC");
                $(".error2").css("display","none");
            }
        });
        //题目选项获得焦点
        $(".option1").focus(function(){
            $(".option1").removeClass("errorC");
            $(".option1").removeClass("checkedN");
            $(".error3").css("display","none");
        });
        //题目选项失去焦点
        $(".option1").blur(function(){
            if( $(".option1").val()==""|| $(".option1").val()=="请输入题目选项内容")
            {
                $(".option1").removeClass("checkedN");
                $(".option1").addClass("errorC");
                $(".error3").html("选项内容不能为空");
                $(".error3").css("display","block");
                islabel = 0;
                alertMsg = "选项内容不能为空";
            }
            else
            {
                $(".option1").addClass("checkedN");
                $(".option1").removeClass("errorC");
                $(".error3").css("display","none");
            }
        });
        //单项选择题
        //题干获得焦点
        $("#stem_dx").focus(function(){
            $("#stem_dx").removeClass("errorC");
            $("#stem_dx").removeClass("checkedN");
            $(".error1_dx").css("display","none");
        });
        //题干失去焦点
        $("#stem_dx").blur(function(){
            if( $("#stem_dx").val()==""|| $("#stem_dx").val()=="请输入题干内容")
            {
                $("#stem_dx").removeClass("checkedN");
                $("#stem_dx").addClass("errorC");
                $(".error1_dx").html("题干内容不能为空");
                $(".error1_dx").css("display","block");
                islabel = 0;
                alertMsg = "题干内容不能为空";
            }
            else
            {
                $("#stem_dx").addClass("checkedN");
                $("#stem_dx").removeClass("errorC");
                $(".error1_dx").css("display","none");
            }
        });
        //题目选项获得焦点
        $(".option0_dx").focus(function(){
            $(".option0_dx").removeClass("errorC");
            $(".option0_dx").removeClass("checkedN");
            $(".error2_dx").css("display","none");
        });
        //题目选项失去焦点
        $(".option0_dx").blur(function(){
            if( $(".option0_dx").val()==""|| $(".option0_dx").val()=="请输入题目选项内容")
            {
                $(".option0_dx").removeClass("checkedN");
                $(".option0_dx").addClass("errorC");
                $(".error2_dx").html("选项内容不能为空");
                $(".error2_dx").css("display","block");
                islabel = 0;
                alertMsg = "选项内容不能为空";
                
            }
            else
            {
                $(".option0_dx").addClass("checkedN");
                $(".option0_dx").removeClass("errorC");
                $(".error2_dx").css("display","none");
            }
        });
    })

    function save(){
        var selectionslen = $('#select-options').children().length;
        var formElement = $("#question")[0];
        var formData = new FormData(formElement);
        if( $("#stem").val()==""|| $("#stem").val()=="请输入题干内容"){
        	BootstrapDialog.confirm({
				title : '提示',
				message : '题干内容不能为空',
				size : BootstrapDialog.SIZE_SMALL,
				type : BootstrapDialog.TYPE_DEFAULT,
				closable : true,
				btnCancelLabel : '取消',
				btnOKLabel : '确定'
			});
           return false;
        }
        if(titleType!=2){
            if(answer==-1){
                BootstrapDialog.confirm({
                    title : '提示',
                    message : '请选择正确答案',
                    size : BootstrapDialog.SIZE_SMALL,
                    type : BootstrapDialog.TYPE_DEFAULT,
                    closable : true,
                    btnCancelLabel : '取消',
                    btnOKLabel : '确定'
                });
                return false;
            }
            $.ajax({
                type:"POST",
                url:'<%=basePath %>depository/addQuestion?size='+currArrayNum+'&answer='+answer ,
                data:formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success:function(data){
                    BootstrapDialog.confirm({
                        title : '提示',
                        message : data.msg,
                        size : BootstrapDialog.SIZE_SMALL,
                        type : BootstrapDialog.TYPE_DEFAULT,
                        closable : true,
                        btnCancelLabel : '取消',
                        btnOKLabel : '确定'
                    });
                }
            })
        } else {
            if(answerArray.length==0){
                BootstrapDialog.confirm({
                    title : '提示',
                    message : '请选择正确答案',
                    size : BootstrapDialog.SIZE_SMALL,
                    type : BootstrapDialog.TYPE_DEFAULT,
                    closable : true,
                    btnCancelLabel : '取消',
                    btnOKLabel : '确定'
                });
            }
            $.ajax({
                type:"POST",
                url:'<%=basePath %>depository/addQuestion?size='+currArrayNum+'&answerArray='+answerArray ,
                data:formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success:function(data){
                    BootstrapDialog.confirm({
                        title : '提示',
                        message : data.msg,
                        size : BootstrapDialog.SIZE_SMALL,
                        type : BootstrapDialog.TYPE_DEFAULT,
                        closable : true,
                        btnCancelLabel : '取消',
                        btnOKLabel : '确定'
                    });
                }
            })
        }

        
    }

    function update(){
        var formElement = $("#question")[0];
        var formData = new FormData(formElement);
        if( $("#stem").val()==""|| $("#stem").val()=="请输入题干内容"){
        	BootstrapDialog.confirm({
				title : '提示',
				message : '题干内容不能为空',
				size : BootstrapDialog.SIZE_SMALL,
				type : BootstrapDialog.TYPE_DEFAULT,
				closable : true,
				btnCancelLabel : '取消',
				btnOKLabel : '确定'
			});
            return false;
        }
       
        if(titleType!=2){
            if(answer==-1){
            	BootstrapDialog.confirm({
    				title : '提示',
    				message : '请选择正确答案',
    				size : BootstrapDialog.SIZE_SMALL,
    				type : BootstrapDialog.TYPE_DEFAULT,
    				closable : true,
    				btnCancelLabel : '取消',
    				btnOKLabel : '确定'
    			});
            	return false;
            }
            $.ajax({
                type:"POST",
                url:'<%=basePath %>depository/updateQuestion?size='+currArrayNum+'&answer='+answer ,
                data:formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success:function(data){
                    BootstrapDialog.confirm({
                        title : '提示',
                        message : data.msg,
                        size : BootstrapDialog.SIZE_SMALL,
                        type : BootstrapDialog.TYPE_DEFAULT,
                        closable : true,
                        btnCancelLabel : '取消',
                        btnOKLabel : '确定'
                    });
                }
            })

        }else{
            if(answerArray.length==0){
            	BootstrapDialog.confirm({
    				title : '提示',
    				message : '请选择正确答案',
    				size : BootstrapDialog.SIZE_SMALL,
    				type : BootstrapDialog.TYPE_DEFAULT,
    				closable : true,
    				btnCancelLabel : '取消',
    				btnOKLabel : '确定'
    			});
            }
            $.ajax({
                type:"POST",
                url:'<%=basePath %>depository/updateQuestion?size='+currArrayNum+'&answerArray='+answerArray ,
                data:formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success:function(data){
                    BootstrapDialog.confirm({
                        title : '提示',
                        message : data.msg,
                        size : BootstrapDialog.SIZE_SMALL,
                        type : BootstrapDialog.TYPE_DEFAULT,
                        closable : true,
                        btnCancelLabel : '取消',
                        btnOKLabel : '确定'
                    });
                }
            })
        }
     
    }
    function clic(label){
        $("#img_upload_op"+label).click();
        var $input = $("#img_upload_op"+label);
        $input.on("change" , function(){
            //3、回显
            var files = this.files;
            var fr = new FileReader();
            fr.onload = function(e){
                $("#op_pict_"+label).attr('src',this.result);
                //$("#pict").src = this.result;
            }
            fr.readAsDataURL(files[0]);//读取文件
        })
    }
</script>

</html>


